<include file="Public:header" />
<div class="container main"> <include file="Public:left" />
  <div class="w790">
  <style>body{background:#fff;}
	.header{display:none;}
	.w790{margin-top:0px;}
  	.groupList li{float:left; height:35px; line-height:35px; background:#ccc; margin:5px 12px;}
	.groupList li.cur{background:#558fca;}
	.groupList li.cur a{color:#fff;}
	.groupList li a{padding:0px 8px; display:block;}
	
	.templateList li{float:left; margin:18px; position:relative;}
	.templateList li a{border:3px solid #ccc; display:block;}
	.templateList li a.cur{border:3px solid #558fca;}
	.templateList li .price{position:absolute; bottom:-30px; height:30px; font-size:18px; font-family:Arial, Helvetica, sans-serif; line-height:30px; width:100%; text-align:left; background:#fff; color:#f00;}
	.templateList li .price em{color:#03F;}
	.templateList li .success{position:absolute; background:#558fca; color:#0F0; font-size:18px; width:100%; text-align:center; left:0px; top:0px; display:none;}
  </style>
    <ul class="groupList">
    <volist name="template_group" id="vo">
    <li <eq name="vo['id']" value="$groupid">class="cur"</eq>><a href="{:U('',array('groupid'=>$vo['id']))}">{$vo.title}</a></li>
    </volist>
    <div class="clear"></div>
    </ul>
     
<div class="table_"><ul class="templateList">
<volist name="list" id="vo">
	<li>
    <gt name="vo['is_free']" value="0"><else/><span class="price"><del>{$vo.price}元</del><em>{$vo.score}积分</em></span></gt>
    <span class="success">操作成功</span>
    <a onclick="setTemplate({$vo.id},{$vo.score},{$vo.is_free});" id="t{$vo.id}" <eq name="vo['id']" value="$curSite['template_id']">class="cur"<else/></eq> href="javascript:;"><img src="__PUBLIC__<notempty name="vo['img_url']">{$vo.img_url}<else/>/Home/{$vo.name}/view.jpg</notempty>" height="300" width="200" /></a></li>
    
</volist>
<div class="clear"></div>
</ul></div>
<div class="pages">{$pages}</div>
  </div>
  <div class="clear"></div>
</div>
<script>
	function setTemplate(id,score,is_free){
		if(is_free<=0){
			var d = artDialog({
				title: '消息',
				content: '如果您还没有购买过该模板，切换模板将扣除您'+score+'积分，您确定吗？',
				okValue: '确 定',
				ok: function () {
						setTemplateSend(id);
				},
				cancelValue: '取消',
				cancel: function () {}
			});
			d.show();
		}else{
			setTemplateSend(id);
		}
	}
	
	function setTemplateSend(id){
		$.post("{:U('setTemplate')}",{template_id:id},function(data){
					if(data.status>0){
						$('.templateList li a').removeClass('cur');
						$('#t'+id).addClass('cur');
						$('#t'+id).prev('.success').show('fast','',function(){
							setTimeout(function(){
								$('#t'+id).prev('.success').hide();},1000);
						});
					}else{
						error(data.info);
					}
				},'json');
	}
</script>
<include file="Public:footer" />